struct ListNode* swapPairs(struct ListNode* head){
    struct ListNode*dummy=malloc(sizeof(struct ListNode));
    dummy->next=head;
    struct ListNode*pre=dummy,*p=pre->next;
    
    while(p!=NULL && p->next!=NULL){
        struct ListNode *tem=p->next;
        p->next=tem->next;
        tem->next=p;
        pre->next=tem;
        pre=p;
        p=pre->next;
    }
    return dummy->next;
}